
#pragma once

class SglDecode
{

public:

	SglDecode();
	~SglDecode();

	const SGL_COLOR *GetImage(VOID) const;
	VOID FreeImage(VOID);
	BOOL DecodeEmpty(UINT nWidth, UINT nHeight, UINT nPitch, SGL_COLOR sBgColor);
	BOOL DecodeDXT1(const SGL_DXT1 *pData, UINT nWidth, UINT nHeight, UINT nPitch, SGL_COLOR sBgColor);
	BOOL DecodeDXT3(const SGL_DXT3 *pData, UINT nWidth, UINT nHeight, UINT nPitch, SGL_COLOR sBgColor);

	static BOOL DecodeEmptyAlpha(SGL_COLOR *pImage, UINT nWidth, UINT nHeight, UINT nPitch, SGL_COLOR sBgColor);
	static BOOL DecodeDXT1Alpha(SGL_COLOR *pImage, UINT nWidth, UINT nHeight, UINT nPitch, const SGL_DXT1 *pData, SGL_COLOR sBgColor);
	static BOOL DecodeDXT3Alpha(SGL_COLOR *pImage, UINT nWidth, UINT nHeight, UINT nPitch, const SGL_DXT3 *pData, SGL_COLOR sBgColor);

	static BOOL AlphaBlend(LPCVOID pAlpha, UINT nWidth, UINT nHeight, SGL_COLOR sBgColor, LPVOID pData, UINT nPitch);
	static BOOL GetEmptyAlpha(UINT nWidth, UINT nHeight, LPVOID pBuffer, UINT nPitch);
	static BOOL GetDXT1Alpha(const SGL_DXT1 *pData, UINT nWidth, UINT nHeight, LPVOID pBuffer, UINT nPitch);
	static BOOL GetDXT3Alpha(const SGL_DXT3 *pData, UINT nWidth, UINT nHeight, LPVOID pBuffer, UINT nPitch);

protected:

	SGL_COLOR	*m_Image;

	static VOID DecodeEmpty(UINT nWidth, UINT nHeight, SGL_COLOR *pBuffer, UINT nPitch, SGL_COLOR sBgColor);
	static VOID DecodeDXT1(const SGL_DXT1 *pData, UINT nWidth, UINT nHeight, SGL_COLOR *pBuffer, UINT nPitch, SGL_COLOR sBgColor);
	static VOID DecodeDXT3(const SGL_DXT3 *pData, UINT nWidth, UINT nHeight, SGL_COLOR *pBuffer, UINT nPitch, SGL_COLOR sBgColor);

};
